<script src="/Public/js/ckeditor/samples/plugins/htmlwriter/assets/outputforflash/swfobject.js"></script>
<div class="form-group">
	<label class="col-sm-2 control-label">{:L($name)}：<span class="check-tips"></span></label>
	<input type="text" name="{$name}" id="{$name}" value="{$value|default=''}"/>
	<div class="col-sm-10">
		<input type="file" id="upload_flash_{$name}">
        <div class=" upload-img-box">
    		<notempty name="value">
    			<div class="upload-pre-item">
    			<div id="_flash"></div>
    			<script>swfobject.embedSWF('{$value}', '_flash', '100', '60', '9.0.0');</script>
    			</div>
    		</notempty>
        </div>
	</div>
</div>
<script type="text/javascript">

$(document).ready(function(){
    $("#upload_flash_{$name}").uploadify({
        "height"          : 30,
        "swf"             : "__STATIC__/uploadify/uploadify.swf",
        "fileObjName"     : "download",
        "buttonText"      : "上传动画",
        "uploader"        : "{:U('ActivityTheme/uploadFlash',array('session_id'=>session_id()))}",
        "width"           : 120,
        'removeTimeout'   : 1,
        'fileTypeExts'    : '*.swf;',
        "onUploadSuccess" : uploadPicture_{$name},
        'onFallback' : function() {
            alert('未检测到兼容版本的Flash.');
        }
    });
});
function uploadPicture_{$name}(file, data){
    var data = $.parseJSON(data);
    var src = '';
    if(data.status){
        src = data.url || '__ROOT__' + data.path;
        $("#{$name}").val(src);
        $("#{$name}").parent().find('.upload-img-box').html(
            '<div class="upload-pre-item"><img src="' + src + '"/></div>'
        );
    } else {
        updateAlert(data.info);
        setTimeout(function(){
            $('#top-alert').find('button').click();
            $(that).removeClass('disabled').prop('disabled',false);
        },1500);
    }
}
</script>